<template>
	<view class="content">
		<view class="top_image">
			<image class="topbox" src="../../static/login_topbg.png" mode="aspectFill"></image>
		</view>
		<view class="login_box">
			<view class="toplogo">
				<image src="/static/logo.png" mode="aspectFill" class="logo"></image>
			</view>
			<view class="txtbox" @click="isXieyi">
				<image :src="isXZ?'/static/y-xz.png':'/static/y-wx.png'" mode="aspectFill"></image>
				<text>已同意</text><text class="txt2">《油米车盟用户协议，隐私政策》</text>
			</view>
			<button :disabled="isDJ" class='dl_btns' plain="true" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
				一键授权登录  
			</button>
		</view>
		<!-- 弹框 -->
		<view class="mask" v-if="isTk"></view>
		<view class="tk_box" v-if="isTk">
			<view class="tk_text" v-html="xyStr"></view>
			<view class="tk_button" v-if="isTk">
				<view class="but_no" @click="no">不同意</view>
				<view class="but_ok" @click="ok">同意</view>
			</view>
		</view>
	</view>
	
</template>

<script>
	export default {
		data() {
			return {
				isTk: false,
				isXZ: true,
				xyStr:'',
			}
		},
		created() {
			uni.setStorageSync('token','&^%$#@w2sdf982w983skjdfwe(**$%^&');
			//获取富文本
			this.getStr();
		},
		mounted(){
			var a = document.getElementsByClassName('login')[0]
			a.style.display = 'none';
			console.log(121212121)
		},
		methods: {
			
			
			//是否遵守协议
			isXieyi() {
				this.isTk = true;
				this.isXZ = !this.isYd;
			},
			//获取富文本
			getStr() {
				var _this = this;
				uni.request({
					
					// url: uni.getStorageSync('SER_URL') +'/html/purchase_agreement.html',
					url: 'https://api.youmichemeng.com/html/purchase_agreement.html',
					success(res) {
						var rx = /<body[^>]*>([\s\S]+?)<\/body>/i ///
						var m = rx.exec(res.data);
						if (m) m = m[1];
						_this.xyStr = m;
					},
					complete(res) {}
				})
				
			},
			//同意协议事件
			ok() {
				this.isTk = false
				this.isXZ = true
			},
			//不同意协议事件
			no() {
				this.isTk = false
				this.isXZ = false
			}
		}
	}
</script>

<style lang="scss">
	.content{
		.tk_box{
			padding: 0 20rpx;
			box-sizing: border-box;
			width: 620rpx;
			height: 690rpx;
			background: #fff;
			position: fixed;
			left: 50%;
			top: 50%;
			transform: translate(-50%, -50%);
			z-index: 22;
			border-radius: 10rpx;
			
			.tk_text{
				padding-top: 20rpx;
				box-sizing: border-box;
				text-align: left;
				height: 500rpx;
				width: 580rpx;
				margin: 0 auto;
				overflow-y: auto;
			}
			.tk_button{
				width: 600rpx;
				height: 90rpx;
				position: relative;
				top: 74rpx;
				display: flex;
				margin-left: -10rpx;
				.but_no{
					width: 270rpx;
					height: 78rpx;
					line-height: 78rpx;
					text-align: center;
					font-size: 26rpx;
					border-radius: 10rpx;
					border: 2rpx solid #c5c5c5;
					background: #f0f0f0;
					margin: 6rpx auto;
				}
				.but_ok{
					width: 270rpx;
					height: 78rpx;
					line-height: 78rpx;
					text-align: center;
					font-size: 26rpx;
					border-radius: 10rpx;
					border: 2rpx solid #3a9a41;
					background: #3a9a41;
					color: #fff;
					padding-right: 20rpx;
					margin: 6rpx auto;
				}
			}
		}
		
		.mask{
			width: 100%;
			height: 100%;
			position: fixed;
			left: 0;
			top: 0;
			background: rgba(0, 0, 0, .7);
			z-index: 10;
		}
		.top_image{
			width: 750rpx;
			height: 420rpx;
			.topbox{
				width: 100%;
				height: 100%;
			}
		}
		.login_box{
			margin: 0 auto;
			z-index: 9;
			.toplogo{
				width: 248rpx;
				height: 350rpx;
				margin: 0 auto;
				position: relative;
				.logo{
					width:248rpx ;
					height: 306rpx;
					margin-top: 22rpx;
				}
			}
			.txtbox{
				padding-top: 50rpx;
				box-sizing: border-box;
				text-align: left;
				height: 100rpx;
				width: 575rpx;
				margin: 0 auto;
				overflow-y: auto;
				image{
					width: 28rpx;
					height: 28rpx;
					position: relative;
					top: 2rpx;
					margin-right: 10rpx;
				};
				text{
					color: #4CC56E;
					font-size: 28rpx;
				}
			}
			.dl_btns {
				width: 70%;
				height: 70rpx;
				margin: 80rpx auto;
				background: #00d3dc !important;
				font-size: 34rpx;
				font-weight: bold;
				border-radius: 8rpx;
				color: #fff !important;
				line-height: 70rpx;
				border: none;
				
			}
		}
	}
	
</style>
